<!--********************* Part1:Jsp Head *********************-->

<%@ page contentType="text/html;charset=UTF-8"%>  
<%@ include file="/framework/head.jsp"%>

<!--********************* Part2:Java Code *********************-->

<!--********************* Part3:JavaScript Code ***************-->
<!--start 客户端脚本区域-->
<script language=javascript>

<%
String msg = (String)session.getAttribute("MSG");
session.removeAttribute("MSG");
if(msg != null){
%>
    alert("<%=msg%>");
<%
}
%>

var list_code = "listReportCustomerInList";

function copyToList(from,to)
{
  fromList = eval('document.forms[0].' + from);
  toList = eval('document.forms[0].' + to);
  if (toList.options.length > 0 && toList.options[0].value == 'temp')
  {
    toList.options.length = 0;
  }
  var sel = false;
  for (i=0;i<fromList.options.length;i++)
  {
    var current = fromList.options[i];
    if (current.selected)
    {
      sel = true;
      if (current.value == 'temp')
      {
        alert ('你不能选择这个项目!');
        return;
      }
      txt = current.text;
      val = current.value;
      toList.options[toList.length] = new Option(txt,val);
      fromList.options[i] = null;
      i--;
    }
  }
  if (!sel) alert ('你还没有选择任何项目');
}

function process(val)
{
    if(GetValue("i_CustomerName") == ""){
        alert("供货单位不可为空!");
        return false;
    }
    //从领料单位查询列表中取值
    var str = "";
    var sel = document.all["chosen"];
    //alert("length="+sel.options.length);
    if(sel.options.length>0){
        for(var i=0;i<sel.options.length;i++){
            if(i==sel.options.length-1){
                str += sel.options[i].value;
            }else{
                str += sel.options[i].value+",";
            }
        }
    }
    if(str=="temp"){
        str = "";
    }
    //if(chosen.option.l)
    
    SetValue("title","6");
    SetValue("customerName",GetValue("i_CustomerName"));
    SetValue("getCustomer",str);  //GetValue("chosen")
    SetValue("warehouseCode","<%=loginInfo.getLoginWarehouseCode()%>");
    
    if(val == '1'){
        SetValue("begindate",GetValue("i_Year"));
        SetValue("enddate",GetValue("i_Month"));
        SetValue("querytype","1");
    }else{
        if(GetValue("i_StartLastUpdate") == ""){
            alert("起始日期不可为空!");
            return false;
        }
        SetValue("begindate",GetValue("i_StartLastUpdate"));
        SetValue("enddate",GetValue("i_EndLastUpdate"));
        SetValue("querytype","2");
    }
    
    frm.action = "<%=response.encodeURL(Config.getWebPath() + "/servlet/ReportServlet") %>";
    frm.submit();
}

</script>


<%=uiBody%>>

<!--********************* Part4:Form  ***************-->
<form id=frm action="<%=Config.getSrv()%>" method="post">
<input type=hidden name="customerName" value="">
<input type=hidden name="warehouseCode" value="">
<input type=hidden name="getCustomer" value="">
<input type='hidden' name='begindate' value="">
<input type='hidden' name='enddate' value="">
<input type='hidden' name='querytype' value="">
<input type='hidden' name='title' value="">

<!--查询条件保留区域-->


<br>
<!--********************* Part5:Search Area ***************-->
<%=uiSearchStart%>>
<%
    int key_tab = 1 ;
%>

<table id=listTable cellpadding='1' cellspacing='1' width='100%' class='data_line'><thead class='data_th'>

<tr align='center' height='24'>

    <td colspan = "2">合并库收料清单</td></tr>

    
<tbody class='data_tb'>
    <tr height="24"  bgcolor="#EBEEF3">
        <td colspan = "2">
        &nbsp;&nbsp;供货单位：<input type="text" class="texts" name="i_CustomerName" size="20" value="" key_tab="<%=key_tab++%>">&nbsp;<font color="#FF0000">*</font>
        </td>

    </tr>
    
    <tr height="24"  bgcolor="#EBEEF3">
        <!-- <input type="text" class="texts" name="i_Customers" size="20" value="" key_tab="<%=key_tab++%>"> -->
        <td colspan="2">&nbsp;&nbsp;领料单位：
            <table>
                <tr>
                    <td><select name="possible" size="4" MULTIPLE
                        width=200 style="width: 200px;height:150px">
                        <%ObjectList list = Customer.fetchAllOrgs(con);

        for (int j = 0; j < list.size(); j++)
        {
            Customer c = (Customer) list.get(j);
            
            int number = c.getCode().length()/Customer.PRIX.length()-1;
            String rtn = "";
            for (int i=0;i<number;i++){
                rtn += SelectManager.SELECT_PRIX_VALUE;
            }
            %>
                        <option value="<%=""+c.getCode()%>"><%=rtn+c.viewName(con)+"("+c.viewCode(con)+")" %></option>
                        <%
        } %>
                    </select></td>
                    <td><a
                        href="javascript:copyToList('possible','chosen')">添加至查询列表--><br>
                    <br>
                    </a><a href="javascript:copyToList('chosen','possible')"><--取消查询</a></td>
                    <td><select name="chosen" size="4" MULTIPLE
                        width=200 style="width: 200px;height:150px">
                        <option value="temp">从左边选择您需要查询的领料单位</option>
                    </select></td>
                </tr>
            </table>
            </td>
    </tr>    

    <tr height="24"  bgcolor="#FFFFFF">

        <td >&nbsp;选择结算月份：<%=SelectManager.viewYearSelect(con,"i_Year","2008",false,"","-请选择-","","")%>  <%=SelectManager.viewMonthSelect(con,"i_Month","01",false,"","-请选择-","","")%></td>

        <td >
            <input type="button" name="button1" class='buttons' value="生成报表" onclick='process(1)'>
        </td>
    </tr>

    <tr height="24"  bgcolor="#EBEEF3">

    
        <td >&nbsp;&nbsp;&nbsp;选择时间段：<%=framework.custom.UIManager.generateDateInput("i_StartLastUpdate", "")%> 至 <%=framework.custom.UIManager.generateDateInput("i_EndLastUpdate", "")%></td>
    

        <td >
            <input type="button" name="button2" class='buttons' value="生成报表" onclick='process(2)'>
        </td>
    </tr>
</tbody>

</table>


<%=uiSearchEnd%>

</form>


<%@ include file="/framework/foot.jsp"%>
